<?php
require('system-config.php');
require_once(PRIVATEROOT . 'wp-includes/registration-functions.php');

validateToken($_POST['token'], 'registrationlist.php');

$filename = $_FILES['emaillist']['tmp_name'];
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize($filename));
fclose ($fd);

$contents = $wpdb->escape($contents);
$wpdb->query("DELETE FROM `$wpdb->options` WHERE option_name = 'registration_list'");
$wpdb->query("INSERT INTO `$wpdb->options` (`option_name`,`option_value`, `option_domain`) VALUES ('registration_list', '$contents', 'system') ");

header("Location: settings.php");

?>